package com.example.mapp;

import com.example.entity.AdviceNote;
import org.apache.ibatis.annotations.*;

/**
 * Created by youkun on 2017/10/3.
 */
@Mapper
public interface AdviceNoteMapp {

    @Select(" select * from advice_note where id = #{id}")
    AdviceNote findById(String id) throws Exception;

    @Delete(" delete from advice_note where id = #{id}")
    int deleteById(String id) throws Exception;

    @Update(" update advice_note set an_type=#{anType},marks=#{marks} where id=#{id}")
    int update(AdviceNote adviceNote) throws Exception;

    @Insert(" insert into advice_note " +
            " (an_type,marks,pic_url1, pic_url2,pic_url3,send_party_id,receive_party_id,is_read) " +
            "value " +
            "(#{anType},#{marks},#{picUrl1}, #{picUrl2},#{picUrl3},#{sendPartyId},#{receivePartyId},#{isRead})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    int insert(AdviceNote adviceNote) throws Exception;
}
